package com.qna.serviceimpl;

import java.text.ParseException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.qna.pojo.Question;
import com.qna.repository.QuestionRepository;
import com.qna.service.QuestionService;;


/**
 * provides services for user.
 *
 */
@Service("questionDetailsService")
@Transactional(readOnly = true)
public class QuestionServiceImpl implements QuestionService {
	
    @Autowired
    private QuestionRepository questionRepository;
    
    public List<Question> getAll() {

        return questionRepository.getAll();
    }
    
    @Transactional(readOnly = false)
    public Question create(Question question) throws ParseException {

    	return questionRepository.merge(question);
        
    }
    
}
